<template>
    <div style="border: 1px solid red;">
        <h2>儿子在这</h2>
        <h2>{{ msg }}</h2>
        <h1>全局状态管理的数据：{{ store.state.userName }} {{ store.getters.usernameLength }}</h1>
    </div>
</template>

<script setup>
import { inject } from 'vue';
import { useStore } from 'vuex';
import bus from '../tools/bus'

import { useNum, useHaha } from '../hooks/useNum'
const  mynum = useNum();

console.log(mynum.num.value);
mynum.sayHello();

// const num = ref(999)

// console.log(this.$store.state.userName);  因为没有 this 所以在 js 中不能这样获取
const store = useStore();
console.log(store.getters.usernameLength);

bus.on("mittGetInfo", (msg)=>{
    console.log("mitt 触发了兄弟组件通信", msg);
})



const msg = inject('msg')
</script>

<style lang="scss" scoped>

</style>